package cn.ronghuanet.org.controller;

import cn.ronghuanet.base.util.AjaxResult;
import cn.ronghuanet.base.util.PageInfo;
import cn.ronghuanet.org.domain.Department;
import cn.ronghuanet.org.domain.Employee;
import cn.ronghuanet.org.query.DepartmentQuery;
import cn.ronghuanet.org.service.IDepartmentService;
import cn.ronghuanet.org.service.IEmployeeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Objects;

//@Controller
@Api(value = "员工管理",description = "员工操作的CRUD")
@RequestMapping("/employee")
@RestController  // 该controller所有的接口均返回数据
public class EmployeeController {
    @Autowired
    private IEmployeeService service;

    // 查全部 get
    @GetMapping
    public AjaxResult selectList() {
        // 有返回值
        try {
            List<Employee> employees = service.selectAll();
            return AjaxResult.success(employees);
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.error(e.getMessage());
        }


    }
}
